package com.zhijian.medical.controller;

import com.zhijian.medical.annotation.Response;
import com.zhijian.medical.entity.vo.response.UploadVo;
import com.zhijian.medical.service.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author HCG
 * @version 1.0
 * @date 2022/1/3
 */
@Slf4j
@Controller
@Api(tags = "上传文件")
public class UploadController {

    @Autowired
    private UploadService uploadService;

    /**
     * 上传
     *
     * @param file 上传的文件
     * @return
     */
    @Response
    @PostMapping("/upload/file")
    @ApiOperation("上传文件")
    public UploadVo upload(@RequestParam MultipartFile file) {
        return uploadService.upload(file);
    }

    /**
     * 上传数字切片文件
     *
     * @param file 上传的文件
     * @return
     */
    @Response
    @PostMapping("/upload/dsc/file")
    @ApiOperation("上传数字切片文件")
    public UploadVo uploadDsc(@RequestParam MultipartFile file) {
        return uploadService.uploadDsc(file);
    }
}
